<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>主页</title>

    <link href="${pageContext.request.contextPath}/statics/css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/statics/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <style>
        body {
            font-family: Arial, Helvetica, sans-serif;
            padding: 20px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            text-align: left;
        }
        table, th, td {
            border: 1px solid #ddd;
            padding: 15px;
        }
        th {
            background-color: #f2f2f2;
        }
        input[type="submit"] {
            background-color: #4CAF50; /* Green */
            color: white;
            padding: 12px 20px;
            margin: 8px 0;
            border: none;
            cursor: pointer;
        }
        a.btn {
            margin: 10px;
        }
        p {
            border: 1px solid #ddd;
            padding: 15px;
            text-align: center;
            background-color: #f2f2f2;
        }
    </style>

</head>

<table class="table table-bordered table-hover">
    <thead>
    <tr>
        <td>菜单ID</td>
        <td>菜单名称</td>
        <td>父菜单ID</td>
        <td>显示顺序</td>
        <td>请求地址</td>
        <td>打开方式</td>
        <td>菜单类型</td>
        <td>菜单状态</td>
        <td>是否刷新</td>
        <td>权限标识</td>
        <td>菜单图标</td>
        <td>创建者</td>
        <td>创建时间</td>
        <td>更新者</td>
        <td>更新时间</td>
        <td>备注</td>
        <td>操作</td>
    </tr>
    </thead>

    <c:forEach var="menu" items="${list}">
        <tr>
            <td>${menu.menu_id}</td>
            <td>${menu.menu_name}</td>
            <td>${menu.parent_id}</td>
            <td>${menu.order_num}</td>
            <td>${menu.url}</td>
            <td>${menu.target}</td>
            <td>${menu.menu_type}</td>
            <td>${menu.visible}</td>
            <td>${menu.is_refresh}</td>
            <td>${menu.perms}</td>
            <td>${menu.icon}</td>
            <td>${menu.create_by}</td>
            <td>${menu.create_time}</td>
            <td>${menu.update_by}</td>
            <td>${menu.update_time}</td>
            <td>${menu.remark}</td>
            <td>
                <a  href="add_v3.jsp" class="btn btn-success" onclick="$.operate.add(100)" shiro:hasPermission="system:dept:add">
                    <i class="fa fa-plus"></i> 新增
                </a>
                <a href="edit_v3?menu_id=${menu.menu_id}" class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="system:dept:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>

                <a href="JavaScript:void(0)" class="btn btn-danger" style="color: white;" onclick="del(${menu.menu_id})">
                    <i class="fa fa-remove"></i> 删除
                </a>

            </td>
        </tr>
    </c:forEach>
</table>

<div style="text-align:center;">
    <nav>
        <ul class="pagination">
            <li><a href="list_v3?pageNo=1">首页</a></li>
            <li><a href="list_v3?pageNo=${param.pageNo-1}">上一页</a></li>
            <li><a href="list_v3?pageNo=${param.pageNo+1}">下一页</a></li>
            <li><a href="list_v3?pageNo=${totalPages}">末页</a></li>
        </ul>
    </nav>
    <p>共有 ${totalCount} 条记录</p>
</div>

<script>
    function  del(menu_id){
        let con =confirm('确定要删除'+menu_id+'吗?')
        if (con){
            location='delete_v3?menu_id='+menu_id;
        }
    }
</script>
